﻿using UnityEngine;
using System.Collections;

public class lobbyRoomPScropt : MonoBehaviour {
	
	public UISprite headCase;
	public UILabel nameLabel;
	public RoomSelector parentPanel;
	public string playerName;
	public int playerID;
	public string mapName;
	public string roomName;
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		
	}
	
	public void attachInfo()
	{
		parentPanel.lobbyInfo.updateInfo(roomName,mapName,playerName);
		//Debug.Log("CLICKED");
	}
	
	public void InitPanel(string com)
	{
		Debug.Log(com);
		string[] dataInfo = com.Split('_');
		roomName = dataInfo[0];
		nameLabel.text = roomName;
		//for(int i = 0; i < dataInfo.Length; i++)
		//{
		//	Debug.Log(dataInfo[i] + i);
		//}
		playerName = dataInfo[1];
		mapName = dataInfo[2];
		Debug.Log(dataInfo[3]);
		playerID = int.Parse(dataInfo[3]);

		headCase.spriteName = "icon_roomcreator" + playerID.ToString();
		//headCase.mainTexture = parentPanel.roomPaneTex[playerID];
	}
}
